<?PHP

function isServiceSelected($option)
{
	//echo '<br> iss - ' . $option . '<br>';
	if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_GET["mode"]))
	{
	addDebug('iss method - post');
		@$service=$_POST['service'];
		if(is_array($service))
		{
			while (list ($key, $val) = each($service))
			{
				if ($val == $option) 
				{
					echo 'selected';
					addDebug('selected: '.$key.' - '.$val);
				}
			}
		}	
	}
	else
	{
		addDebug('iss method - get');
		if (isset($_SESSION[$option]))
		{
			if ($_SESSION[$option] == 'Y')
			{
				echo 'selected';
				addDebug2($option . ' is selected');
			}
			else
				echo '';
			addDebug2($option.' iss option : '.$_SESSION[$option]);
		}
		else
			echo '';
	}
}
function addDebug($s)
{
echo $s;
}
	?>
	
	<div id="serviceFld">
<span class="txt0 bold">Your services</span><span class ="txt1"> (select all that apply)<br>
<select name="service[]" id="service" multiple="multiple"> <!-- class="dfltf" -->
<option value="airtrans" <?php isServiceSelected('airtrans'); ?>> Airport Service</option>
<option value="wedding" <?php isServiceSelected('wedding'); ?>> Weddings</option>
<option value="prom" <?php isServiceSelected('prom'); ?>> Prom</option>
<option value="bachelor" <?php isServiceSelected('bachelor'); ?>> Bachelor(ette) Party</option>
<option value="anniversaries" <?php isServiceSelected('anniversaries'); ?>> Anniversaries</option>
<option value="pt2pt" <?php isServiceSelected('pt2pt'); ?>> Point 2 Point</option>
<option value="birthday" <?php isServiceSelected('birthday'); ?>> Birthday Parties</option>
<option value="concert" <?php isServiceSelected('concert'); ?>> Concerts</option>
<option value="grads" <?php isServiceSelected('grads'); ?>> Graduation</option>
<option value="sports" <?php isServiceSelected('sports'); ?>> Sports Events</option>
<option value="holiday" <?php isServiceSelected('holiday'); ?>> Holiday Light Tours</option>
<option value="nightout"<?php isServiceSelected('nightout'); ?>> Night on the Town</option>
<option value="other" <?php isServiceSelected('other'); ?>> Other</option>
</select>
</div>

<input type="submit" value="submit">